﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="~/layui/css/layui.css">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.2.0/css/all.css" rel="stylesheet">
    <script src="//at.alicdn.com/t/c/font_3671535_ctisbiz1lpj.js"></script>
    <title>@ViewBag.name</title>
    <style>
        .icon {
            width: 4em;
            height: 4em;
            vertical-align: -0.15em;
            fill: currentColor;
            overflow: hidden;
        }
  
        .bigbd{
            height:180px;
        }
        .smbd{
            height:110px;
        }
        .bd{
            width:25%;
            margin-top: 10px;
            float: left;
            text-align: center;
        }
    </style>
</head>
<body>
    <!-- 内容主体区域 -->
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div id="addmd" class="layui-row layui-col-space15">
        </div>
    </div>

    <script src="~/layui/layui.js"></script>
    <script>
        //获取快捷菜单数据库
        //roleidmenue
        function GetMenuByRid(){
            var data = [];
            $.ajax({
                url: "/Menu/GetMenuByRid",
                data: "rid=@Context.Session.GetString("rid")",
                type: "post",
                async: false,
                success: function (result) {
                    data = result;
                }
            });
            return data;
        }
        //添加快捷菜单div
        layui.use(['element','jquery'],function(){
            var element = layui.element;
            var $ = layui.$;

            var data = GetMenuByRid();
            var listr1 ="";
            var listr10 ="";
            var listr13 ="";
            var listr15 ="";
            var head1="";
            var head10="";
            var head13="";
            var head15="";
            var end="";
            var all="";
            for(var i=0;i<data.length;i++){
                //if(data[i].parentId == -1 && data[i].id == 1){
                if(data[i].id == 1){
                    head1 += "<div class=\"layui-col-md12\"><div class=\"layui-card\" ><div class=\"layui-card-header\" > " + data[i].name + "</div><div class=\"layui-card-body\"><div class=\"bigbd\"> ";
                } else if (data[i].id == 10) {
                    head10 += "</div></div></div></div><div class=\"layui-col-md12\"><div class=\"layui-card\" ><div class=\"layui-card-header\" > " + data[i].name + "</div><div class=\"layui-card-body\"><div class=\"bigbd\">";
                } else if (data[i].id == 13) {
                    head13 += "</div></div></div></div><div class=\"layui-col-md12\"><div class=\"layui-card\" ><div class=\"layui-card-header\" > " + data[i].name + "</div><div class=\"layui-card-body\"><div class=\"bigbd\">";
                } else if (data[i].id == 15) {
                    head15 += "</div></div></div></div><div class=\"layui-col-md12\"><div class=\"layui-card\" ><div class=\"layui-card-header\" > " + data[i].name + "</div><div class=\"layui-card-body\"><div class=\"bigbd\">";
                } else if(data[i].parentId == 1){
                    listr1 += "<div class=\"bd\"><a href=\"" + data[i].menuURL + "\"><svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#" + data[i].icon + "\"></use></svg><br /><span>" + data[i].name + "</span > </a></div > ";
                } else if(data[i].parentId == 10){
                    listr10 += "<div class=\"bd\"><a href=\"" + data[i].menuURL + "\"><svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#" + data[i].icon + "\"></use></svg><br /><span>" + data[i].name + "</span></a></div>";
                } else if(data[i].parentId == 13){
                    listr13 += "<div class=\"bd\"><a href=\"" + data[i].menuURL + "\"><svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#" + data[i].icon + "\"></use></svg><br /><span>" + data[i].name + "</span></a></div>";
                } else if(data[i].parentId == 15){
                    listr15 += "<div class=\"bd\"><a href=\"" + data[i].menuURL + "\"><svg class=\"icon\" aria-hidden=\"true\"><use xlink:href=\"#" + data[i].icon + "\"></use></svg><br /><span>" + data[i].name + "</span></a></div>";
                }
                end = "</div></div></div></div>";
            }
        all = head1 + listr1 + head10 + listr10 + head13 + listr13 + head15 + listr15 + end;
            $("#addmd").html(all);


            element.init();

        });
    </script>
</body>
</html>
